﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace AirlineCommon
{
    public abstract class TravelClass
    {
        private string _SectorID;

        public string SectorID
        {
            get
            {
                return _SectorID;
            }
            set
            {
                _SectorID = value;
            }
        }
       
        public abstract float GetFareAmount();
        public abstract int GetSeatAvailable(string flightNo, DateTime flightdate);

        public abstract void UpdateClassSeat(string flightNo, DateTime FlightDate);
        public abstract int UpdateClassSeatForReservation(SqlTransaction trans,string flightNo, DateTime FlightDate);
        public abstract int UpdateClassSeatForCancellation(SqlTransaction trans, string flightNo, DateTime FlightDate);
        public float CalculateRefundAmt(float Amount, string status, DateTime TravelDate)
        {
            if (status == "OverBook" || status == "Waitlisted")
            {
                return Amount;
            }
            else
            {
                if ((TravelDate.Subtract(DateTime.Now.Date).Days <= 1))
                {

                    return Amount * float.Parse("0.9");
                }
                else
                {
                    return Amount;
                }
            }
        }
    }
}
